package com.yirui.serialcomm.controller;

import com.yirui.serialcomm.core.PortListUtil;
import com.yirui.serialcomm.server.SerialCommToNetwork;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author Dujie
 * @create 2025/8/5
 * @since 1.0.0
 */
@RestController
public class HomeController {
    @Autowired
    private SerialCommToNetwork serialCommToNetwork;
    /**
     * 获取当前硬件支持的串口信息
     * @return
     */
    @GetMapping("/ports")
    public List getPortList(){
        return PortListUtil.list();
    }
    @GetMapping("/status")
    public Map getStatus(){
        return serialCommToNetwork.getStatus();
    }
}
